package com.cskaoyan.controller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.domain.MarketUser;
import com.cskaoyan.service.FeedbackService;
import com.cskaoyan.service.FeedbackServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {
    @Autowired
    FeedbackService feedbackService;

@PostMapping("submit")
    public BaseRespVo submit(@RequestBody Map map) {
    Subject subject = SecurityUtils.getSubject();
    Integer userId=0;
    if (subject.isAuthenticated()) {
        MarketUser principal = (MarketUser) subject.getPrincipal();
        userId = principal.getId();
    }
    BaseRespVo baseRespVo=feedbackService.adviceSubmit(map,userId);
    return baseRespVo;
    }
}
